
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
   import="java.util.ArrayList, db.*" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Checkout Customer</title>
<link href="styles/style.css" rel="stylesheet" type="text/css">
<link href="styles/type.css" rel="stylesheet" type="text/css">
<link href="styles/buttons.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" media="only screen and (-webkit-min-device-pixel-ratio: 2)"      type="text/css" href="styles/highdpi.css" />

<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/highdpi.js"></script>
<script type="text/javascript" src="scripts/custom.js"></script>
 <!-- utility js -->
<script type="text/javascript" src="../scripts/fronteraWebUtility.js"></script>
 <script>
function formSubmit(type)
{
	if(type == "checkOutList")
		{
		document.getElementById("checkout").action = "server.jsp";
		document.getElementById("checkout").submit();
		
		}
	else
		{
		document.getElementById("checkout").action = "../Admin";
		document.getElementById("checkout").submit();
		}

}

</script>
</head>
<body>
<% DBHelper helper = new DBHelper();
  
	String _errorMessage = "";
	String _userName = "";
	String _loginID = "";
	Cookie[] cookies = request.getCookies();
	ArrayList<UserData> userInfo =  new ArrayList<UserData>();
	ArrayList<Coupons> couponInfo =  new ArrayList<Coupons>();
	int admin = 0;
	int server = 0;
	int checkID = 0;
	String showAdminBtn = "none";
	String showServerBtn = "none";
	ArrayList<UserCheckInData> checkedInCusInfo = new ArrayList<UserCheckInData>();
	
	
	int chkInId = Integer.parseInt(request.getParameter("checkInID"));
	int storeCkInId = Integer.parseInt(request.getParameter("storeID"));
	
	int customerId = Integer.parseInt(request.getParameter("customerID"));
	int serverId = Integer.parseInt(request.getParameter("serverID"));
	
	 System.out.println("customerId " + customerId);
	 System.out.println("storeCkInId " + storeCkInId);
	 System.out.println("serverId " + serverId);
	 System.out.println("chkInId " + chkInId);
	checkedInCusInfo = helper.getIndivCheckedInUserInfo(chkInId);
	
   if(request.getAttribute("userName") != null)
   {
	    Object g =  request.getAttribute("userName");
	    String p = g.toString();
	    System.out.println(p + " print larry");
	   String gg = g.toString();
	   _errorMessage = "";
	   String[] arr=gg.split(",");
       System.out.println("Array :"+arr.length);
       for(int i=0;i<arr.length;i++)
       {
           System.out.println("array"+i+"  :"+arr[i]);
           session.setAttribute("sesUserInfo",arr[i]);
           //_errorMessage += arr[i];
       }
      
      
   }
   else
   {
	   _errorMessage = "";
   }
   if(session.getAttribute("adminRights") != null)
   {
   	   
   	    Object g =  session.getAttribute("adminRights");
   	    admin = Integer.parseInt(g.toString());
   	    if(admin == 1)
   		{
   	    	 showAdminBtn = "inline";
   		}
   	   
   	   
   	    System.out.println(" showAdminBtn ==  " + admin);
   }
   if(session.getAttribute("serverRights") != null)
   {
   	   
   	    Object g =  session.getAttribute("serverRights");
   	    server = Integer.parseInt(g.toString());
   	    if(server == 1)
   		{
   	    	showServerBtn = "inline";
   		}
   	    
   	    System.out.println(" showServerBtn ==  " + server);
   }

 
   %>
<div class="landing-page">
        <p class="center-text landing-logo shadow">
        <img class="replace-2x" width="200" src="../assets/frontera-pesos-logo.png" alt="img">
        </p> 
        <center>
        <p>
        
        <span style="display:<%=showAdminBtn%>">
        <a href="admin-view.jsp">Administration</a> - <a href="admin-view-customer.jsp">Customer Info</a>- 
        
        </span>
        <span style="display:<%=showServerBtn%>">
        <a href="server.jsp"  >Server</a> -
        </span>
        <span>
        <a href="admin-view-faq.html">Faq</a>-
         <a href="userHomePage.jsp">Home</a>
         </span>
         </p>
         <span>
       <p><a  href="javascript:void(0);" onClick="logUserOut();"><strong>Logout</strong></a><strong></strong></p>
        </span>
      
    
            
        <div class="tablet-box-expanded">
      <div class="tablet-customer">
       <% for(int i = 0; i < checkedInCusInfo.size(); i++) { 
     System.out.println(" checkedInCusInfo "+ i);
     
     %>  
    
        <h2><%=checkedInCusInfo.get(i).getCustFullName()%><br/>
       <%=FormatAndValidation.formatPhoneNumber(checkedInCusInfo.get(i).getPhoneNumber())%></h2>
        <h2>Total Pesos: <%=checkedInCusInfo.get(i).getTotalPesos()%> </h2>
        <h2>&nbsp;</h2>
        <p>&nbsp;</p>
       
        
        <h1>Reward(s) Redeemed Today</h1>
        
       
       <div class="tablet-box-redeem">
         <h4><%=checkedInCusInfo.get(i).getCouponName()%><br/>
           <%=checkedInCusInfo.get(i).getCouponPointVal()%> Pesos
         </h4>
       </div>
       <% } %>
      
       
      
        <h1>&nbsp;</h1>
        <h1>Checkout Customer</h1>
        <p>
        <form id="checkout" name="checkout" target="_self"  method="post">
          <input type="number" id="default" placeholder="Bill SubTotal" name="subTotal" class="text-input"  />
          <input id="default"  placeholder="Ticket ID" name="ticketId" class="text-input"  />
          <input type="hidden" name="checkInID" id="checkInID" value="<%=chkInId%>"/>
   		  <input type="hidden" name="storeID" id="storeID" value="<%=storeCkInId%>"/>
   		  <input type="hidden" name="customerID" id="customerID" value="<%=customerId%>"/>
   		  <input type="hidden" name="serverID" id="serverID" value="<%=serverId%>"/>
   		  <input type="hidden" name="adminRequestType" id="adminRequestType" value="checkOut" placeholder="adminRequestType" />
        </p>
       
        
         <span id="login-button"><a class="buttonBigYellow-checkout" onclick="formSubmit('checkOut')" href="javascript:void(0)">Checkout</a></span> 
        </form>
        <p>&nbsp;</p>
      </div>
        </div>
        </a>
    </center>
    

<!--    <p class="login-note shadow"><strong>*</strong>Forgot my Password</p> -->
<div style="height:25px;"></div>
</div>
<style>
#registration-block{
        display:none;
}
</style>

    </div>
<script>
    $('#register-button').click(function() {
      $('#registration-block').fadeIn('slow', function() {
        // Animation complete
      });
    });
</script>

</body>
</html>